package com.cyzy.controller;

import com.cyzy.dto.Result;
import com.cyzy.service.ArtGalleryService;
import com.cyzy.vo.ChildAlbum;
import com.cyzy.vo.UserAlbum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description: 艺术馆里面的艺术家相册
 * @author: yangJingShi
 * @date: 2025/6/18 下午2:16
 * @param:
 * @return:
 **/
@RestController
@RequestMapping("/artAblum")
public class ArtAlbumController {

    @Autowired
    private ArtGalleryService artGalleryService;

    /**
     * @description: 家长查询自家小孩的相册，老师查询班级相册
     * @author: yangJingShi
     * @date: 2025/6/18 下午2:22
     * @param: [parentId, teacherId]
     * @return: com.cyzy.dto.Result
     **/
    @GetMapping("/geyUserStu")
    public Result getUserStu(@RequestParam("parentId") Long parentId,
                             @RequestParam("teacherId") Long teacherId){
        List<ChildAlbum> childAlbums = artGalleryService.queryChildAlbum(parentId,teacherId);
        return Result.ok().data("childAlbums",childAlbums);
    }

    /**
     * @description: 查询当前学生的艺术家相册和点赞数
     * @author: yangJingShi
     * @date: 2025/6/19 下午12:26
     * @param: []
     * @return: com.cyzy.dto.Result
     **/
    @GetMapping("/queryStuAlbum")
    public Result queryStuAlbum(@RequestParam("stuId") Long stuId){
        System.out.println("当前学生的ID:"+stuId);
        List<UserAlbum> userAlbums = artGalleryService.selectUserAlbumList(stuId);
        System.out.println("该用户的user相册："+userAlbums);
        return Result.ok().message("查询当前学生的相册").data("userAlbums",userAlbums);
    }
}
